#include <iostream>

class Drink
{
public:
    virtual void Water() = 0;
    virtual void Material() = 0;
    virtual void Boil() = 0;
/* 父类设置工作顺序 */
    void MakeDrink()
    {
        Water();
        Material();
        Boil();
    }
};

/* 子类去实现具体的工作内容 */
class MilkTea : public Drink
{
public:
    void Water()
    {
        std::cout<<" 水加入冰块 "<<std::endl;
    }
    void Material()
    {
        std::cout<<" 倒入奶茶粉"<<std::endl;
    }
    void Boil()
    {
        std::cout<<" 将奶茶粉搅拌均匀"<<std::endl;
    }

};

class Coffee : public Drink
{
public:
    void Water()
    {
        std::cout<<" 水加入冰块 "<<std::endl;
    }
    void Material()
    {
        std::cout<<" 倒入咖啡粉"<<std::endl;
    }
    void Boil()
    {
        std::cout<<" 将咖啡粉搅拌均匀"<<std::endl;
    }

};

int main()
{
    Drink * d1 = new MilkTea;
    Drink * d2 = new Coffee;

    d1->MakeDrink();        //牛奶：水加入冰块 倒入奶茶粉 将奶茶粉搅拌均匀
    d2->MakeDrink();        //咖啡：水加入冰块 倒入咖啡粉 将咖啡粉搅拌均匀
    return 0; 
}